#version 450
layout(location = 2) in vec2 v_texcoord;
layout(set = 0, binding = 0) uniform sampler2D tex_y;
layout(set = 0, binding = 1) uniform sampler2D tex_uv;
layout(location = 0) out vec4 FragColor;
void main(){
    vec3 yuv;
    yuv.x = texture(tex_y, v_texcoord).r;
    yuv.y = texture(tex_uv, v_texcoord).g - 0.5;
    yuv.z = texture(tex_uv, v_texcoord).r - 0.5;
    //highp vec3 rgb = mat3( 1,       1,      1,             //BT.601
    //                       0,     -0.3455,  1.779,
    //                       1.4075, -0.7169,  0) * yuv;

    //highp vec3 rgb = mat3( 1,       1,      1,              //BT.709
    //                       0,     -0.1868,  1.856,
    //                       1.5478, -0.4680,  0) * yuv;

    vec3 rgb = mat3( 1,       1,      1,                // BT.2020
                           0,     -0.1645,  1.8814,
                           1.4746, -0.5713,  0) * yuv;

    FragColor = vec4(rgb, 1);
}